package dto

import (
	"engine/model"
	"lib/db"
	"time"
)

func GetMayListByUid(uid uint64) ([]*model.My_may, error) {
	var MyMay []*model.My_may
	err := db.GetDb().Select("count(1)").Where("uid=? and ", uid).Group("level").Find(&MyMay).Error
	if err != nil {
		return MyMay, err
	}
	return MyMay, nil
}
func GetMaLevelCount(uid uint64, level int) int64 {
	var count int64
	enc_time := time.Now()
	db.GetDb().Debug().Table("my_may").Select("count(1)").Where("uid=? and level=? and end_time>? ", uid, level, enc_time.Format("2006-01-02 15:04:05")).Count(&count)
	return count
}
